/**
 * @author : andy
 * @description : 用户权限登录/登出，这里目前只是写了获取用户的操作，登录和登出还没有写
 */
import { defineStore } from "pinia";
import { useUserStore } from "./user";
import { getUserInfoApi } from "@/apis/mock/user";
import type { UserInfo } from "./types";
export const useAuthStore = defineStore('auth' , () => {
  const userStore = useUserStore();
  const login = () => {
    console.log('login');
  }
  const logout = () => {
    console.log('logout');
  }
  const getUser = async () => {
    const result = await getUserInfoApi();
    const userInfo = result.data as UserInfo;
    userStore.setUserInfo(userInfo);
  }
  return {
    login,
    logout,
    getUser
  }
})